home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 65.zip / BS1 part 65 / Elan performer v2.0.adf / Recorder / record.rexx < prev    next >
OS/2 REXX Batch file  |  1978-10-16  |  4KB  |  146 lines

  1. /* Rev 7.26.90 */
  2. /* RECORD <Enviroment> */
  3.  
  4. x = RemLib("rexxarplib.library")
  5. x = RemLib("rexxsupport.library")
  6. If addlib("rexxsupport.library",0,-30,0) then Do
  7.     Say ""
  8.     Say "Enter name of file to record to:"
  9.     Pull FileName
  10.     ARG PicEnv
  11.     If PicEnv = '' then do
  12.         Say "Enter directory and name of enviroment to use:"
  13.         PULL PicEnv 
  14.     end
  15.     
  16.     if exists(PicEnv) then do
  17.         address command
  18.         "run /Performer2.0"
  19.         Say ""
  20.         Say "Loading Elan Performer 2.0 ..."
  21.         do for 60 while ~show('Ports','PERFORMER')
  22.       call delay 25  /* 0.5 sec */
  23.      end
  24.  
  25.         if show('Ports','PERFORMER') then do
  26.             address PERFORMER
  27.             LOAD PicEnv
  28.             call openport "KEYPORT" 
  29.             if show('Ports','KEYPORT') then do
  30.                 PICRELAY KEYPORT
  31.                 
  32.                 Say ""
  33.                 Say 'Exit Recorder by double-clicking the Stop icon.'
  34.                 rec = 0
  35.                 KeyNum = 0
  36.                 OldTime = 0
  37.                 Written = 0
  38.                 Closed = 1
  39.                 packet = '0000 0000'x
  40.                 Call Time('R')
  41.                 do while KeyNum ~= 55
  42.                     do while packet = '0000 0000'x
  43.                         call waitpkt('KEYPORT')
  44.                         KeyTime = time('E')+OldTime
  45.                         packet = getpkt('KEYPORT')
  46.                     end
  47.                     pktstring = getarg(packet)
  48.                     KeyNum = SUBWORD(pktstring,2,1)
  49.                     x = index(KeyNum, "00"x)
  50.                     If x>0 then KeyNum = DELSTR(KeyNum, x)    /* Removes Trailing 0's form String 2.0 Only */
  51.                     if KeyNum = 51 then do    /* Record */
  52.                         CALL TIME('R')
  53.                         If Closed then do
  54.                             x = Open( 'RecFile',FileName,'W')
  55.                             x = Writeln('RecFile','Rx' PRAGMA('Directory')|| '/Play' FileName)
  56.                             x = Writeln('RecFile','QUIT')
  57.                             x = Writeln('RecFile',PicEnv)
  58.                         end
  59.                         Rec=1
  60.                         Closed = 0
  61.                     end
  62.                     else 
  63.                     if KeyNum = 53 then Do    /* Pause */
  64.                         Rec = 0
  65.                         OldTime = Time('E')+OldTime
  66.                     end
  67.                     else
  68.                     if KeyNum = 54 | KeyNum = 55 then do    /* Stop */
  69.                         x = Close('RecFile')
  70.                         OldTime =0
  71.                         Address Command
  72.                         if Written then
  73.     
  74.                         'Copy Record.icon' FileName || '.info'   
  75.  
  76.                         else
  77.                             if Exists(FileName) then 'Delete' FileName
  78.                         Closed = 1
  79.                         Rec = 0
  80.                     end
  81.                     else
  82.                     if KeyNum = 52 then do    /* PlayBack */
  83.                         if Written & ~ Closed then do
  84.                             x = Close('RecFile')
  85.                             OldTime =0
  86.                             Address Command
  87.                             'Copy Record.icon' FileName || '.info'
  88.                             Closed = 1
  89.                             Rec = 0
  90.                         end
  91.                         if Written & Closed Then Do
  92.                             If Open('RecFile',FileName,'R') then Do
  93.                                 x = Readln('RecFile')
  94.                                 x = Readln('RecFile')
  95.                                 x = Readln('RecFile')
  96.                                 Call Time('R')
  97.                                 Address PERFORMER
  98.                                 KN = 0
  99.                                 Do While ~ (EOF('RecFile') | KN = 55 | KN = 54)
  100.                                     FileRec = Readln('RecFile')
  101.                                     KeyNum = SUBWORD(FileRec,1,1)
  102.                                     KeyTime = SUBWORD(FileRec,2,1)
  103.                                     DO WHILE (TIME('E') < KeyTime)
  104.                                         x = (KeyTime-Time('E'))*50-2
  105.                                         If x > 1 & 0 ~= (x // 10) then Call DELAY(x)
  106.                                     END
  107.                                     If KeyNum ~= "" then KEY KeyNum
  108.                                     KN = 0
  109.                                     p=1
  110.                                     do while ~( p = '0000 0000'x | KN = 55 | KN = 54) 
  111.                                         p = getpkt('KEYPORT')
  112.                                         If p ~= '0000 0000'x then KN = SUBWORD(getarg(p),2,1)
  113.                                     end
  114.                                 end
  115.                                 x = Close('RecFile')
  116.                                 OldTime =0
  117.                             end
  118.                          else say "Can't open file:" FileName
  119.                         end
  120.                     end
  121.                     else
  122.                     if rec = 1 & (KeyNum < 51 | KeyNum > 55) then DO    /* Record Key */
  123.                         x = Writeln('RecFile',KeyNum KeyTime)
  124.                         Written = 1
  125.                     end
  126.                     call reply(packet,0)
  127.                     packet = '0000 0000'x
  128.                 end        
  129.                 Call CLOSEPORT("KEYPORT")
  130.             end
  131.             else say "Can't open KEYPORT."
  132.             address Performer
  133.                         Call delay(25)
  134.             QUIT
  135.         end
  136.         else Say "Can't Find Elan Performer 2.0"
  137.     end    
  138.     else say 'Can''t find Enviroment:' PicEnv
  139.         
  140. end
  141. else Say "The ARexx RexxSupport.Library must be installed in Libs directory."
  142.  
  143. x = RemLib("rexxsupport.library")
  144.  
  145. exit(0)
  146.